// 1,新建文件 /widgets/page_content.dart

//2,添加material 依赖
import 'package:flutter/material.dart';
import 'package:flutterapp/routes.dart';

//3, 编写无状态组件
class PageContent extends StatelessWidget {
  final String name;

  //4,添加name参数
  const PageContent({Key key, this.name}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        centerTitle: true, // 标题居中
        title: Text('当前页面:$name'),
      ),
      body: ListView(
        children: [
          FlatButton(
              onPressed: () {
                Navigator.pushNamed(context, Routes.home);
              },
              child: Text(Routes.home)),
          FlatButton(
              onPressed: () {
                Navigator.pushNamed(context, Routes.login);
              },
              child: Text(Routes.login)),
          FlatButton(
              onPressed: () {
                Navigator.pushNamed(context, '/asaaa');
              },
              child: Text('不存在的页面')),
          FlatButton(
              onPressed: () {
                Navigator.pushNamed(context, '/room/2222');
              },
              child: Text('房屋详情页,id:2222')),
        ],
      ),
    );
  }
}

//5,** 使用Scaffold
